﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

using CP.Entities;
using CP.Repositories.GPM;
using CP.Utility;

namespace CP.Controllers.GPM
{
    public class MenuController
    {
        MenuRepository rep = new MenuRepository();
        public IList<Menu> GetAllMenus()
        {
            return rep.GetAllMenus();
        }

        public IList<Menu> GetAllMenuParents()
        {
            return rep.GetAllMenuParents();
        }

        public Menu GetMenuByID(int id)
        {
            return rep.GetMenuByID(id);
        }

        public bool AddMenu(Menu Menu)
        {
            return rep.AddMenu(Menu);
        }

        public bool EditMenu(Menu Menu)
        {
            return rep.UpdateMenu(Menu); 
        }

        public bool DeleteMenus(IList<int> Menus)
        {
            return rep.DeleteMenu(Menus);
        }

        public IList<Menu> GetMenusByUserID(string userid)
        {
            return rep.GetMenusByUserID(userid);
        }

        public DataTable GetFormInfoByMenuID(int menuid)
        {
            return rep.GetFormInfo(menuid);
        }

        public IList<string> GetButtonsByUserForm(string userid, string formname)
        {
            ButtonRepository bRep = new ButtonRepository();
            return bRep.SelectButtonsByUserID(userid, formname);
        }
    }
}
